package com.kbt.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;
import com.kbt.model.data.UserVipInfo;

/**
 * @Title: KBT_ANDRIOD
 * @Copyright: KJ Co., Ltd. Copyright 2015-2020,  All rights reserved
 * @Description: ${todo}我的会员
 * @author: zhgk
 * @data: 2015/8/17 14:05
 * @version: V1.0
 */
public class VipActivity extends Activity {

    private UserVipInfo info;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.user_vip);
        this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_return_btn);

        //设置返回按钮事件,关闭当前Activity，返回数据
        ImageView returnImg = (ImageView) findViewById(R.id.return_btn);
        returnImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //不创建地址
                setResult(RESULT_CANCELED, null);
                finish();
            }
        });

        TextView appTitleView = (TextView) findViewById(R.id.center_title);
        appTitleView.setText("我的会员");
    }

    @Override
    protected void onStart() {
        super.onStart();
        //初始化数据
        initViewData();
        //初始视图
        initView();
    }

    /**
     * 初始化视图
     */
    private void initView() {
        TextView vipLevelView = (TextView) findViewById(R.id.userVipTextView);
        vipLevelView.setText(info.getVipLevel());

        TextView vipQyView = (TextView) findViewById(R.id.userVipQyTextView);
        vipQyView.setText(info.getVipQy());

        TextView vipCostView = (TextView) findViewById(R.id.vipCoastTextView);
        vipCostView.setText("￥"+String.valueOf(info.getVipCost()));

        TextView vipNeedView = (TextView) findViewById(R.id.vipUpTextView);
        vipNeedView.setText("￥"+String.valueOf(info.getVipUpdateNeed()));

        TextView vipSubTextView = (TextView) findViewById(R.id.vipSubTextView);
        vipSubTextView.setText("￥"+String.valueOf(info.getVipUpdateNeed()));

        TextView vipInfoTextView = (TextView) findViewById(R.id.vipInfoTextView);
        vipInfoTextView.setText(String.valueOf(info.getVipDesc()));


    }

    //初始化数据
    private void initViewData() {
        info = new UserVipInfo();
        info.setVipCost(230.00f);
        info.setVipSub(33.00f);
        info.setVipUpdateNeed(120.45f);
        info.setVipLevel("银牌会员");
        info.setVipQy("购物9拆优惠");
        info.setVipDesc("12222222222222222222243255555555555555555555555567567\n sdgdfghdfhfdhfgh\n sddgdfgdfgfd\ns" +
                "dfsdf 2rsgdgdfhfdhh\n  sfsdgdflgjiodgfiosdfiosdgjiojgdgj\n");
    }


}
